package com.wash.shoes.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
@AllArgsConstructor
public enum UserBindTypeEnum {

    SHOP("shop", "店铺"), FACTORY("factory", "工厂");

    @EnumValue
    private String code;
    @JsonValue
    private String desc;

    @JsonCreator
    public static UserBindTypeEnum getByCode(String code) {
        for (UserBindTypeEnum value : UserBindTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
